#!/bin/bash

until nc -z -v -w30 ${DATABASE_HOST} ${DATABASE_PORT}
do
  echo "Trying to connect to MySQL at ${DATABASE_HOST}:${DATABASE_PORT}..."
  # wait for 5 seconds before check again
  sleep 5
done

java -Djava.security.egd=file:/dev/./urandom "$@" -jar $APP_JAR
